<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/jpeg" href="logo.jpg"/>
    <link rel="manifest" href="manifest.json" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>星链</title>
    <style>
      .van-popup.vant-loading {
        background: rgb(0 0 0 / 42%);
      }

      .van-notify--danger {
        background: var(--van-notify-danger-background) !important;
      }
      .van-notify--success {
        background: var(--van-notify-success-background) !important;
      }
    </style>
    <script type="text/javascript">
      var deferredPrompt

      window.addEventListener('beforeinstallprompt', function (e) {
        // Prevent Chrome 67 and earlier from automatically showing the prompt
        // e.preventDefault();
        // // Stash the event so it can be triggered later.
        // deferredPrompt = e;
        // // Update UI to notify the user they can add to home screen
        // document.getElementById('prompt').style.display = 'block';
        //
        // btnAdd.addEventListener('click', (e) => {
        //   // hide our user interface that shows our A2HS button
        //   // Show the prompt
        //   deferredPrompt.prompt();
        //   // Wait for the user to respond to the prompt
        //   deferredPrompt.userChoice
        //     .then((choiceResult) => {
        //       if (choiceResult.outcome === 'accepted') {
        //         console.log('User accepted the A2HS prompt');
        //       } else {
        //         console.log('User dismissed the A2HS prompt');
        //       }
        //       deferredPrompt = null;
        //     });
        // });
      })

      //判断是否在桌面
      function isOnScreen() {
        return (
          document.fullscreenElement ||
          document.webkitFullscreenElement ||
          document.mozFullScreenElement ||
          document.msFullscreenElement
        )
      }

      if (isOnScreen()) {
        console.log('当前网页在桌面')
      } else {
        console.log('当前网页不在桌面')
      }
    </script>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
